perm filename DEMO.DIA[LSP,JRA] blob
sn#269196 filedate 1977-03-10 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00008 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 system features
C00003 00003 show sos line editing
C00004 00004 flashes
C00005 00005 wise: a desk calculator (circa 1966, pdp-1)
C00006 00006 FACTORIAL DEBUGGING IN MACHINE LANGUAGE (RAID: circa 1964, pdp-1)
C00008 00007 IN LISP (1958, ibm704)
C00011 00008 TIME PERMITTING (REWRITE)
C00012 ENDMK
C⊗;
system features
displays
multiplexing dpys and keyboard mapping
line editing
show sos line editing
the display editor. (derivative of TVEDIT, circa 1965, pdp-1)
show teach file
features:
attach and copy modes
pages and directory
marks
searches
CREATE UPSET
flashes
DIRED
COOPERATION OF DISPLAY WITH INCOMING MESSAGES.
HOT
music
xgp
ddfont
xgpsyn
spell (using display, word selection by numbers), accept, and replace
wise: a desk calculator (circa 1966, pdp-1)
24
βR
=
*
*****DON'T FORGET "Q"***** IN FACT(24)
*** DO "IMPLIED" *
Lα LOADS MACRO
Sα SAVES IT
Kα COMPILES
Pα PRINTS CODE
MF
(A)IF A=0 THEN RETURN (1) ELSE RETURN A*F(A-1)
<alt>
E
3
<cntrl>F
MF
Z1
add BEGIN PAUSE HIYA; .... END
E
3
<cntrl>F
PF
FACTORIAL DEBUGGING IN MACHINE LANGUAGE (RAID: circa 1964, pdp-1)
assemble fact: debug fact
clear screen: βi
load up screen: FACT; >>>>>>>>>>
note that FACT is preempted by DDTEND; kill it: DDTENDαk
open and protect AC1, AC2, P: <name>; α; or <name>α;
dynamically open P: Pε[
now notice that we neglected to initialize the stack
designated by P.
1. define PATCH as START+5: PATCH ← START+5
2. stuff P with stack pointer: P;-300,,PATCH
note dynamic update of P and tos.
ready to execute; go to start for single step: START;
single step: βs
note that MOVEI AC1,0 is wrong, and fix:
1. arrow to START: β<
2. get MOVEI AC1,0 in line buffer to edit: βE
3. edit (search 0, type 1) and replace (<cr>)
single step through fact(1) and fact(2)
notice that fact(3) is wrong; and source of bug is
premature subtract. fix it by retying instrs. in opposite order
move to start and βs through fact(3); it works
since we believe fact works we βx-it.
the result is 30; convert to decimal: AC1; αd
do fact(6)
IN LISP (1958, ibm704)
write improper definition:
(DE FACT (X)(COND((ZEROP X) L)(T(TIMES X (SUB1 X <alt>
this is supposedly a representation of:
fact[x] <= [x=0 → 1; t → *[x;fact[x-1]]]
do (FACT 0)
it breaks at L; type >1 to replace L by 1 and continue.
do (FACT 4)
it gives 14 (octal) change base and get 12.
notice loss in definition and call editor
(EDITF FACT $
nP down to (& & (SUB1 X))
(BI 2) insert parens (incorrectly) on second element
(UNDO) correct correction
(BI 3) do it right
3P move to third element and print it
(-1 FACT) add FACT as first element of list.
↑ go up to top-level structure
PP and print it.
OK bless it and leave
(TRACE FACT)
**********
DEFINE
f[x] <= [x=0 → 1; t → g[x]]
(DE F (X)(COND ((ZEROP Z) 1)(T (G X)))
do (F 1)
do (F 2)
G breaks
at least three options:
1. >FACT replace G by FACT
2. (DE G (X)(TIMES X(F (SUB1 X)))) define G
GO ... and continue
3. BKV patch F
EDIT -1 edit part of the saved stack
F G by locating G,
UP getting "above" (G X)
P check it
(1 (TIMES X (F (SUB1 X)))) replace first element with (TIMES ...)
↑ check it
PP
OK exit editor to break package
FROM?= exit break with stack pushed back to edited expression.
TIME PERMITTING (REWRITE)
reduce: a macsyma-like LISP-based language
2+3;
5
2+4+(x+y+x);
2x+y+6
other pdp-1 programs: Culler-Fried